<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">

<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    <div class="container-div">
		<div class="btn-group hidden-xs" id="toolbar" role="group">
			<a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="module:packet:add">
				<i class="fa fa-plus"></i> 新增
			</a>
			<a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.addCustom('/addNormal')" shiro:hasPermission="module:packet:addRedPacketNormal">
				<i class="fa fa-plus"></i> 新增私人红包
			</a>
			<a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" shiro:hasPermission="module:packet:remove">
				<i class="fa fa-trash-o"></i> 删除
			</a>
		</div>
			
		<div class="col-sm-12 select-info table-striped">
			<table id="bootstrap-table" data-mobile-responsive="true"></table>
		</div>
    </div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('module:packet:edit')}]];
        var removeFlag = [[${@permission.hasPermi('module:packet:remove')}]];
        var redPacketDatas = [[${@dict.getType('red_packet_type')}]];
        var redPacketStatusDatas = [[${@dict.getType('red_packet_status')}]];
        var prefix = ctx + "module/packet";

        $(function() {
            var options = {
                base_url: prefix,
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                modalName: "母红包",
                limit:50,
                sortName : "ctime",
                sortOrder : "desc",
                columns: [{
		            checkbox: true
		        },
				{
					field : 'redPacketAdmount', 
					title : '红包金额' 
				},
				{
					field : 'redPacketRemark', 
					title : '红包描述' 
				},
				{
					field : 'redPacketQuantity', 
					title : '子红包数量'
				},
				{
					field : 'redPacketType',
					title : '红包类型',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(redPacketDatas, value);
                    }
				},
				{
					field : 'redPacketStatus',
					title : '红包状态 ',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(redPacketStatusDatas, value);
                    }
				},
				{
					field : 'ctime',
					title : '创建时间，'
				}]
            };
            $.table.init(options);


        });
    </script>
</body>
</html>